home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr10 / inter35c.zip / WINHELP.ZIP / BOT2RTF.AWK next >
Text File  |  1993-01-30  |  3KB  |  71 lines

  1.  
  2. BEGIN{
  3.   printf("{\\rtf\n")
  4.   printf("{\\fonttbl\n")
  5.   printf("\\f0\\froman Times New Roman;\n")
  6.   printf("\\f1\\fdecor Courier New;\n")
  7.   printf("\\f3\\fswiss Arial;\n")
  8. # printf("\\f4\\fnil Monospaced;}\n")  # truetype, but not in standard configuration
  9.   printf("\\f4\\fmodern Terminal;}\n") # only one size available
  10. # printf("\\deff1 \n")}
  11. # printf("\\deff0 \n")}
  12. # printf("\\deff3 \n")}
  13.   printf("\\deff4 \n")
  14.   str1 = " }\\par\n\\pard\\plain\n\\f4\\fs20\\tx1173\\tx2346\\tx3519\\tx4692\\tx5866 "
  15.   printf("\\deftab1173 \n")
  16.   count = 00002
  17. # 2 so that hc reports same topic numbers
  18.  
  19. }
  20. {
  21. line = $0
  22. # first skip some lines
  23. if ($1 ~ /.freeze/) { next; };
  24. if ($1 ~ /\\i\\p\\aUp/) { next };
  25. if ($1 ~ /--/) { next };
  26. if ($1 ~ /───/) { next };
  27.  
  28. # process topic headers
  29. if ($1 ~ /.context/) { sub("@IL","_IL", $2); printf("\\pard\\plain\\page\n#{\\footnote _%sZ }\n+{\\footnote lev9:%-5.5d}\n", $2, count++); next };
  30. if ($1 ~ /.topic/) { printf("${\\footnote %-4.4dB }\nK{\\footnote %s}\n", count, substr($0,7)); next };
  31. # The line below produces produces intelligible titles but file size grows and
  32. # hc must run in OS/2 because of memory requirements.
  33. # if ($1 ~ /.topic/) { printf("${\\footnote %s }\nK{\\footnote %s}\n", substr($0,7), substr($0,7)); next };
  34.  
  35. # mark as bold 'notes:', 'seealso:' etc
  36. if (($1 ~ /\\b/) && ($1 ~ /\\p/)) { sub("\\\\b", "{\\b ", $1); sub("\\\p", " }", $1); line = $0 };
  37.  
  38. # Make headline
  39. if ($0 ~ /\\bINT [0-9A-F]/) { sub("\\\p", str1, line); sub("\\\\b", "\\pard \\qc {\\f3\\b\\fs28 ", line); };
  40.  
  41. # process jump ,references
  42. gsub("\\\i...\\\\a", "{\\uldb ", line)
  43. gsub("\\\i.....",     "}{\\v _",  line);
  44. gsub("\\\\v, ",       "Z}, ",      line);
  45. gsub("\\\\v$",        "Z}",       line);
  46. gsub("\\\\v,$",        "Z}",       line);
  47. # above line is for exceptions, some 10 found in inter32
  48. gsub("@IL", "_IL", line);
  49.  
  50. # process tabs and spaces in line beginning
  51. gsub("\t\t\t\t ", "\\tab\\tab\\tab\\tab ", line);
  52. gsub("\t\t\t ", "\\tab\\tab\\tab ", line);
  53. gsub("\t\t ", "\\tab\\tab ", line);
  54. gsub("\t ", "\\tab ", line);
  55. gsub("\t\t\t\t", "\\tab\\tab\\tab\\tab ", line);
  56. gsub("\t\t\t", "\\tab\\tab\\tab ", line);
  57. gsub("\t\t", "\\tab\\tab ", line);
  58. gsub("\t", "\\tab ", line);
  59. sub("^                            ", "\\tab\\tab\\tab ", line);
  60. sub("^                   ", "\\tab\\tab ", line);
  61. sub("^          ", "\\tab ", line);
  62.  
  63. # hc 3.1 does not allow all chars...
  64. gsub("\ü", "\ⁿ", line)
  65.  
  66. print line "\par "
  67. }
  68. END {
  69.   printf("{\\plain \\page}\n}\n")
  70. }
  71.